<?php
declare (strict_types = 1);
namespace app\admin\validate\market\advert;

use think\Validate;

/**
 * 广告位验证
 */
class Advert extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'    => 'require',
        'place' => 'require|gt:0',

    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'place' => '请选择广告位置',
        'id'    => '操作出错',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['place'],
        'edit'   => ['id', 'place'],
    ];
}
